<template>
    <div class="cmt-father">
        <h3>发飙评论</h3>
        <hr>
        <textarea placeholder="青输入要说我得哦Joi花" maxlength="120" v-model="msg"></textarea>

        <mt-button type="primary" size="large" @click="postComment">发飙评论</mt-button>

        <div class="cmt-list">
            <div class="cmt-item" v-for="(item,i) in cmtlist" :key="item.add_time">
                <div class="cmt-title">
                    第{{i+1}}漏 &nbsp;&nbsp;用户: 匿名用户&nbsp;&nbsp;发飙时间:{{item.add_time}}
                </div>
                <div class="cmt-body">
                    {{item.cot}}
                </div>
            </div>
        </div>

        <mt-button type="danger" size="large" plain>加载更多</mt-button>
    </div>
</template>

<script>
export default {
    data(){
        return {
            cmtlist: [
                {add_time:"2015-11-11", cot:"真的牛" },
                {add_time:"2016-11-11", cot:"真的牛A" },
                {add_time:"2017-11-11", cot:"真的牛B" },
            ],
            msg: '',
        }
    },
    methods: {
        postComment(){

            this.$http.post('')

            var cmt = { 
                add_time: Date.now(),
                cot: this.msg.trim()
            };
            this.cmtlist.unshift(cmt);
            this.msg= "";
        },
    }
}
</script>

<style lang="scss" scoped>
    .cmt-father{
        h3 {
            font-size: 18px;
        }
        textarea {
            font-size: 14px;
            height: 85px;
            margin: 0;
        }
        .cmt-list {
            margin: 5px 0;
            .cmt-item{
                font-size: 13px;
                .cmt-title {
                    line-height: 30px;
                    background-color: rgb(212, 212, 212);
                }
                .cmt-body {
                    line-height: 35px;
                }
            }
        }
    }
</style>